/* author: Mariana Horita
   mariana.horita@gmail.com
   file: Program.cs*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace WriteMyName
{
    class Program
    {
        static void Main(string[] args)
        {
            string path = @"C:\Users\Mariana\Documents\Visual Studio 2010\Projects\WriteMyName\WriteMyName";

            DirectoryInfo d = new DirectoryInfo(path);

            foreach (FileInfo f in d.GetFiles())
            {
                if (f.Extension == ".cs")
                {
                    StreamReader sr = new StreamReader(f.FullName);

                    string aux = sr.ReadToEnd();

                    sr.Close();

                    

                    string myName = @"/* author: Mariana Horita
   mariana.horita@gmail.com" + @"
   file: " + f.Name + @"*/
";
                    if (!aux.StartsWith(myName))
                    {
                        StreamWriter sw = new StreamWriter(f.FullName);
                        sw.Write(myName + aux);
                        sw.Close();
                    }
                }
            }


        }
    }
}
